<div class="modal-header">
  <h3>添加白名单</h3>
</div>
<form id="whitelist-add" class="g-my-form container" [formGroup]="formGroup">
  <div class="modal-body">
    <div class="form-group col-10">
      <div>
        <label>
          设备名称：
        </label>
        {{ data.name }}
      </div>
    </div>
    <div class="form-group col-10">
      <div>
        <label>
          终端别名：
        </label>
        {{ data.pc_name }}
      </div>
    </div>
    <div class="form-group col-10">
      <div>
        <label>
          人员姓名：
        </label>
        {{ data.user_name }}</div>
    </div>
    <div class="form-group required justify-content-between">
      <div class="form-group col-6">
        <label for="alias_name">设备别名</label>
        <input id="alias_name" formControlName="alias_name" type="text" class="form-control" maxlength="20"
          autofocus="alias_name" required />
        <div
          class="invalid-feedback"
          *ngIf="formGroup.get('alias_name').errors as errors"
        >
          <span *ngIf="errors.required">
            设备别名不允许为空
          </span>
        </div>
      </div>
    </div>
    <div class="form-group col-10">
      <div class="form-group required">
        <label for="remaining_date">有效期至</label>
        <div class="form-inline">
          <input class="form-control" formControlName="remaining_date" name="dp" ngbDatepicker
            #d="ngbDatepicker" required>
          <button class="btn btn-primary" (click)="d.toggle()" type="button">
            <i class="la la-calendar"></i>
          </button>
        </div>
      </div>
      <div class="form-check ml-3">
        <input class="form-check-input" type="checkbox" formControlName="permanent" (change)="(permanent())" value="false">
        <label class="form-check-label" for="inlineCheckbox1">永久有效</label>
      </div>
    </div>
    <div class="form-group col-10">
      <label for="remarks">备注</label>
      <input id="remarks" formControlName="remarks" name="des" type="text" maxlength="100" class="form-control" />
    </div>
    <div class="form-group col-10 required">
      <label for="">是否授权给终端 "{{data.pc_name}}"</label>
      <div class="row col-4">
        <select class="form-control" name="authorization" formControlName="authorization" required>
          <option value="1">授权</option>
          <option value="0">不授权</option>
        </select>
      </div>
    </div>
  </div>
  <div class="modal-footer">
    <button type="button" class="btn btn-secondary" (click)="cancel()">
      取消
    </button>
    <button class="btn btn-primary" (click)="create()" [disabled]="submitting">添加</button>
  </div>
</form>